package com.example.impala.model;

import com.cloudera.impala.jdbc41.internal.com.cloudera.altus.shaded.javax.ws.rs.GET;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotEmpty;
import java.util.Objects;

/**
 * @Author: LiuJie
 * @Date: 2019-04-22 16:51
 * @Description:
 */
@Getter
@Setter
public class ImpalaArg {
    @ApiModelProperty(value = "账号",example = "")
    private String username;
    @ApiModelProperty(value = "密码",example = "")
    private String password;
    @ApiModelProperty(value = "连接",example = "jdbc:impala://ip:port")
    @NotEmpty
    private String connectUrl;
    @ApiModelProperty(value = "sql",example = "")
    @NotEmpty
    private String sql;

    private Integer limit;

    @Override
    public String toString() {
        return "ImpalaArg{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", connectUrl='" + connectUrl + '\'' +
                ", sql='" + sql + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ImpalaArg arg = (ImpalaArg) o;
        return Objects.equals(username, arg.username) &&
                Objects.equals(password, arg.password) &&
                Objects.equals(connectUrl, arg.connectUrl) &&
                Objects.equals(sql, arg.sql);
    }

    @Override
    public int hashCode() {
        return Objects.hash(username, password, connectUrl);
    }
}
